package com.dkd.flow.emums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.Arrays;
//任务动作类型
public enum TaskActionType implements IEnum<Integer> {
    OPERATION_TASK(1,
                   "操作"),
    LOG_TASK(2,
             "记录日志");
    @EnumValue
    private final Integer value;
    private final String name;
    TaskActionType(Integer value,
                   String name) {
        this.value = value;
        this.name = name;
    }
    @Override
    @JsonValue
    public Integer getValue() {
        return value;
    }
    public String getName() {
        return name;
    }
    public static TaskActionType getTaskTypeByValue(Integer value) {
        return Arrays.stream(TaskActionType.values()).filter(fv -> fv.value.equals(value)).findFirst().orElse(null);
    }
}
